package com.example;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.cloud.netflix.zuul.EnableZuulProxy;
import org.springframework.cloud.netflix.zuul.filters.ZuulProperties;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * Create with Intellij idea
 * User:鲁智明
 * Date:2018/11/22
 * Time:23:36
 */
@SpringBootApplication
@EnableEurekaClient
@EnableZuulProxy    //开启网关代理
public class AppZuulServer {

    public static void main(String[] args) {
        SpringApplication.run(AppZuulServer.class,args);

    }


    //zuul配置能够使用config实现实时刷新
    @RefreshScope
    @ConfigurationProperties("zuul")
    public ZuulProperties zuulProperties(){
        return new ZuulProperties();
    }

    @RequestMapping("/")
    public String index(){
        return  "访问网管服务成功！";
    }
}
